home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / HYPERBOOK2.DMS / in.adf / Macros / FileToList{fname} < prev    next >
Encoding:
Text File  |  1990-09-23  |  713 b   |  24 lines

  1. /* FileToList(fname)
  2.  
  3.    Create a list object on the current page containing the text of the
  4.    given file. The list has the same name as the file, and an arbitrary
  5.    position and size that can be changed to suit. Other characteristics
  6.    come from the default list. This macro should only be used on
  7.    line-oriented text files.
  8. */
  9. if open(fr, arg(1), 'r') then do
  10.    list = createlist()
  11.    do forever
  12.       line = readln(fr)
  13.       if eof(fr) then leave
  14.       call appenditem(list, line, 1)
  15.       end
  16.    call close(fr)
  17.    call scaletosize(list, 320, 80)
  18.    call setposition(list,  60, 40)
  19.    call setname(list, arg(1))
  20.    call relocate(list, ':')
  21.    end
  22. else
  23.    call inform("Unable to open `" || arg(1) || "'")
  24.